/**
 * 
 */
package model.staff;

import java.sql.ResultSet;
import java.util.ArrayList;

import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import myutil.Connect;

import vo.mixed.CollegeStaffFinancialsVo;
//import vo.mixed.LibraryStudentVo;

/**
 * @author Pooja 
 *
 */
public class FinanceMo {
	ArrayList<CollegeStaffFinancialsVo> list=new ArrayList<CollegeStaffFinancialsVo>();
	public ArrayList<CollegeStaffFinancialsVo> getFinancialDetails() {
		
		HttpSession session;
		session = ServletActionContext.getRequest().getSession();
		int id=(int) session.getAttribute("user_id");
		String query="SELECT salary_amount, salary_date, payment_made, acc_no, transaction_id FROM college_staff_financial WHERE staff_id="+id;
		System.out.println(query);
		Connect c=new Connect();
		try {
			ResultSet rs=c.getResult(query);
			while(rs.next())
			{
				CollegeStaffFinancialsVo vo=new CollegeStaffFinancialsVo();
				vo.setSalary_date(rs.getString("salary_date"));
				vo.setSalary_amount(rs.getInt("salary_amount"));
				vo.setPayment_made(rs.getInt("payment_made"));
				vo.setAcc_no(rs.getInt("acc_no"));
				vo.setTransaction_id(rs.getString("transaction_id"));
				list.add(vo);
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return list;
	}

}
